#ifndef _MSC_VER
#define __forceinline inline
#endif
#include "CTaylor.h"
#include <typeinfo>
#include <iostream>


template<typename T0, typename T1, typename T2>
auto f(const T0 &x, const T1 &y, const T2 &z) -> decltype(std::sin(std::log(7.0*x)+std::exp(y)/(1.0+z))+9)
{	return std::sin(std::log(7.0*x)+std::exp(y)/(1.0+z))+9;
}


int main(int argc, char **argv)
{	typedef std::createCTaylor<boost::mpl::long_<0>, boost::mpl::long_<4> >::type C0;
	typedef std::createCTaylor<boost::mpl::long_<1>, boost::mpl::long_<4> >::type C1;
	typedef std::createCTaylor<boost::mpl::long_<2>, boost::mpl::long_<4> >::type C2;
	double dx, dxStep, dy, dyStep, dz, dzStep;
	unsigned int i, iMax;
	decltype(f(C0(3, 0), C1(4, 0), C2(5, 0))) sSum = 0.0;
	for (dx = atof(argv[1]), dxStep = atof(argv[2]), dy = atof(argv[3]), dyStep = atof(argv[4]), dz = atof(argv[5]), dzStep = atof(argv[6]), i = 0, iMax = atoi(argv[7]); 
		i < iMax;
		++i, dx += dxStep, dy += dyStep, dz += dzStep)
		sSum = sSum + f(C0(dx, 0), C1(dy, 0), C2(dz, 0));
	std::cout << sSum << "\n";
	return 0;
}
